<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../../../common/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<sfa:mainTitle></sfa:mainTitle>
		<%@ include file="../../../common/meta.jsp"%>
		<link rel="stylesheet" href="${path }/css/affixUpload.css"
			type="text/css"></link>
		<script type="text/javascript"
			src="${path}/script/lhgdialog/lhgdialog.min.js">
</script>
		<script type="text/javascript" src="${path}/script/affixUpload.js">
</script>

		<script type="text/javascript">
function opendialog() {
	$.dialog( {
				title : '客户选择',
				lock : true,
				background : '#FFF',
				opacity : 0.1,
				max : false,
				min : false,
				width : '650px',
				height : '550px',
				content : 'url:${path}/customer/manage/see/index/selectcustomer'
			});
}
function addCustomers(customerName, customerId) {
	var list = $.dialog.list;
	for ( var i in list) {
		list[i].close();
	}
	document.getElementById("customerName").value = customerName;
	document.getElementById("customerId").value = customerId;
	$("#customerName").attr("readonly", "true");
}

$(function() {
	$("#btn_submit")
			.click(function() {
				var customerName = $("#customerName").val(); //客户名称
				if(customerName==''){
						art.dialog( {
						icon : "error",
						content : "客户名称称不能为空!",
						lock : true,
						ok : true
						});
					return false;
				}
				
				var customerId = $("#customerId").val(); //客户Id
				var address = $("#address").val(); //
				var visitContent = $("#visitContent").val(); //
				var saleCustomerSeeId = $("#saleCustomerSeeId").val(); //
				
				var visitTime = $("#visitDate").val(); // 拜访时间
				if(visitTime==''){
						art.dialog( {
						icon : "error",
						content : "跟进时间不能为空!",
						lock : true,
						ok : true
						});
					return false;
				}
				var data = {
					 customerId:customerId,
					 address:address,
					 customerName:customerName,
					 visitContent:visitContent,
					 visitTime:visitTime,
					 saleCustomerSeeId:saleCustomerSeeId
				};
				$.ajax( {
					url : "${path}/customer/manage/see/index/update",
					type : "POST",
					timeout : 10000,
					data : data,
					success : function(result) {
								var obj = result;
								if (obj.result == true) {
									art.dialog( {
												icon : "succeed",
												content : "修改成功",
												lock : true,
												ok : function() {
													window.location.href = "${path}/customer/manage/see/index/customers";
												}
											});
								} else {
									art.dialog( {
										icon : "error",
										content : "修改失败",
										lock : true,
										ok : true
									});
								}
							}
						});
			});
});
 
 
</script>
	</head>
	<body id="master">
		<sfa:mainHeader></sfa:mainHeader>
		<div class="main">
			<div class="webpart3 contentarea">
				<div class="webpart-head">
					<div class="webpart-head-item">
					修改跟进
					</div>
				</div>
				<div class="webpart-main">
					<div class="webpart-main-item" style="padding: 30px;">
						<div class="d_formitem">
							<form id="add" method="post">
								<table cellspacing="0" cellpadding="0" class="formitem">
									<tr>
										<td>
											<span> 员工名称 </span>
										</td>
										<td>
											${userName}
										</td>
									</tr>
									<tr>
										<td>
											<span> 客户名称 </span>
										</td>
										<td>
											<input type="text" id="customerName" readonly="true"
												name="customerName" class="input-txt" maxlength="20" value=${customerName} />
											<input type="hidden" id="customerId" name="customerId"
												class="input-txt" maxlength="20" value=${saleCustomerSee.customerId} />
											<a href="#" onclick="opendialog()">添加客户</a>
										</td>
									</tr>
									<tr>
										<td width="15%">
											<span>地点 </span>
										</td>
										<td>
											<input type="text" id="address" name="address"
												class="input-txt" maxlength="20" value=${saleCustomerSee.address}>

										</td>
									</tr>
									<tr>
										<td>
											时间
										</td>
										<td>
											<div id="markDiv">
												<input id="visitDate" name="visitDate"
													onfocus="WdatePicker({startDate:'%y-%M-01',dateFmt:'yyyy-MM-dd',alwaysUseStartDate:true})"
													readOnly="true" class="Wdate inputbox" value = ${saleCustomerSee.visitDate}>
											</div>
										</td>
									</tr>
									
									
									<tr>
										<td width="15%">
											<span>跟进记录 </span>
										</td>
										<td>
											<textarea id="visitContent" name="visitContent">${saleCustomerSee.visitContent}</textarea>

										</td>
									</tr>

									<tr>
										<th>
										</th>
										<td>
										<input type="hidden" id="saleCustomerSeeId" name="saleCustomerSeeId"
												class="input-txt" maxlength="20" value=${id} />
											<input type="button" id="btn_submit" tabindex="5"
												class="linkbtn2" value="提交">
											&nbsp;&nbsp;
											<input type="button" id="btn_back" tabindex="5"
												class="linkbtn2" value="返回"
												onclick="location.href='${path}/customer/manage/see/index/customers';">
										</td>
									</tr>
								</table>
							</form>
						</div>
					</div>
				</div>
				<div class="webpart-foot">
					<div class="webpart-foot-item">
					</div>
				</div>
			</div>
		</div>
		<sfa:mainFooter></sfa:mainFooter>
	</body>
</html>